package com.qiguliuxing.dts.admin.config;

import com.google.common.collect.Lists;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * Bean配置
 *
 * @author zhoujh
 * @date 2022/05/23 17:42
 */
@Configuration
public class BeanConfig {
    @Resource
    SimpleCORSFilter simpleCORSFilter;
    @Bean(name = "corsFilter")
    public FilterRegistrationBean corsFilter() {
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(simpleCORSFilter);
        registrationBean.setUrlPatterns(Lists.newArrayList("/*"));
        registrationBean.setOrder(1);
        return registrationBean;
    }
}
